Skip to main content

Create a VPN profile (vpnconf.create)

Declaration​

ok = vpnconf.create(conf)

Parameters​

  • conf
    Table. Dictionary describing the VPN profile to create.

Returns​

  • ok
    Boolean. true on success; false on failure (usually due to missing or invalid parameters).

Description​

Quickly create a VPN profile. IKEv2 creation is not supported.

Supported fields of conf​

FieldTypeMeaning
dispNamestringDisplay name of the VPN
VPNTypestringVPN type. Supports "PPTP", "L2TP", "IPSec"
serverstringServer address
authorizationstringAccount (username)
passwordstringPassword
secretstring, optionalShared secret; can be empty for PPTP
encrypLevelinteger, optionalEncryption level; default 1
groupstring, optionalGroup name; default ""
VPNSendAllTrafficinteger, optionalSend all traffic; default 1

Example​

local success = vpnconf.create{
dispName = 'DemoVPN', -- VPN display name
VPNType = "L2TP", -- VPN type, supports PPTP, L2TP, IPSec (IKEv2 is not supported)
server = 'vpn.example.com', -- Server address
authorization = 'your_account', -- Account
password = 'your_password', -- Password
secret = 'your_shared_secret', -- Shared secret; PPTP can omit
encrypLevel = 1, -- Encryption level (optional; default 1)
group = '', -- Group name (optional; default "")
VPNSendAllTraffic = 1, -- Send all traffic (optional; default 1)
}
if success then
sys.alert('Created successfully')
else
sys.alert('Creation failed. Please verify the configuration is complete and correct.')
end

Note: Uses sys.alert